#include <stdlib.h>
#include "RakPeer.h"
#include "RakPeerInterface.h"
#include "SocketLayer.h"
#include "server.h"


int main(int argc, char **argv)
{
	/*Server *server = new Server();
	server->log("starting...");
	server->start();
	server->log("up & running...");
	server->join();*/

	RakNet::RakPeerInterface *rakPeer = RakNet::RakPeerInterface::GetInstance();
	RakNet::SocketDescriptor sd;
	sd.socketFamily = AF_INET;
	sd.port = 33000;
	while (RakNet::SocketLayer::IsPortInUse(sd.port, sd.hostAddress, sd.socketFamily) == true)
		sd.port++;
	RakNet::StartupResult sr = rakPeer->Startup(8,&sd,1);
	RakAssert(sr == RakNet::StartupResult::RAKNET_STARTED);
	rakPeer->SetMaximumIncomingConnections(8);
	rakPeer->SetTimeoutTime(1000, RakNet::UNASSIGNED_SYSTEM_ADDRESS);

	system("pause");
	return EXIT_SUCCESS;
}